import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

import static jdk.nashorn.internal.objects.NativeMath.max;

public class Test1 {
    public static void printNow() {
        DateFormat df = new SimpleDateFormat();
        Date date = new Date();
        String text = df.format(date);
        System.out.println("北京时间："+text);
    }
    public static void initArray(double[] array) {
        Random random = new Random();
        for (int i = 0; i < array.length; i++) {
            array[i] = random.nextDouble();
        }
    }
    public static String formatNum(double num) {
        String pattern = "0.##";
        DecimalFormat df = new DecimalFormat();
        return df.format(num);
    }

    public static void main(String[] args) {
        double[] array = new double[10];
        printNow();
        initArray(array);
        double num = max(array);
        System.out.println("最大的随机数："+formatNum(num));
    }
}
